package com.huawei.appmarket.service.settings.card;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.text.TextUtils;
import com.huawei.appgallery.foundation.service.common.protocol.AppDetailActivityProtocol;
import com.huawei.appgallery.foundation.service.common.protocol.AppDetailActivityProtocol.Request;
import com.huawei.hms.support.api.entity.hwid.HwIDConstant.ACTION;
import java.net.URI;
import java.net.URISyntaxException;
import o.cjk;
import o.cjm;
import o.cjo;
import o.cvx;
import o.Logger;
import o.drj;

public class BaseAboutCard extends BaseSettingCard {
    protected PackageInfo ʼ;
    protected PackageManager ॱ;

    public BaseAboutCard(Context context) {
        super(context);
    }

    protected void ˊ(String str) {
        if (TextUtils.isEmpty(str)) {
            Logger.ˋ("BaseAboutCard", "website url is empty");
            return;
        }
        try {
            if (this.ᐝ != null) {
                this.ᐝ.startActivity(new Intent(ACTION.HWID_SCHEME_URL, Uri.parse(str)));
            }
        } catch (Exception e) {
            Logger.ˋ("BaseAboutCard", e.toString());
        }
    }

    protected boolean ˏ(String str) {
        try {
            this.ॱ = this.ᐝ.getPackageManager();
            this.ʼ = this.ॱ.getPackageInfo(str, 0);
        } catch (NameNotFoundException e) {
            Logger.e("BaseAboutCard", "appIsInstalled(String packageName) " + e.toString());
        }
        if (this.ʼ == null) {
            return false;
        }
        this.ʼ = null;
        return true;
    }

    protected void ˎ(String str) {
        cjo appDetailActivityProtocol = new AppDetailActivityProtocol();
        appDetailActivityProtocol.ˏ(new Request(drj.ॱ(str), null));
        cjk.ˎ().ˋ(this.ᐝ, new cjm("appdetail.activity", appDetailActivityProtocol));
    }

    protected String ˎ() {
        try {
            URI uri = new URI(cvx.ˎ("server.store"));
            return new URI(uri.getScheme(), null, uri.getHost(), uri.getPort(), null, null, null).toString();
        } catch (URISyntaxException e) {
            Logger.ˋ("BaseAboutCard", "getRedirectUrl error:" + e.toString());
            return "";
        }
    }
}
